import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      components:{
        header:  () => import('../components/Header.vue'),
        footer:  () => import('../components/Footer.vue'),
        default: () => import('../views/Home.vue')
      }
    },
    {
      path: '/login',
      name: 'login',
      components: {
        default: () => import('../views/Login.vue')
      }
    },
    {
      path: '/ask',
      name: 'ask',
      components: {
        header:  () => import('../components/Header.vue'),
        footer:  () => import('../components/Footer.vue'),
        default: () => import('../views/Ask.vue')
      }
    },
    {
      path: '/my',
      name: 'my',
      components: {
        header:  () => import('../components/Header.vue'),
        footer:  () => import('../components/Footer.vue'),
        default: () => import('../views/My.vue')
      }
    },
    {
      path: '/detail/:id',
      name: 'detail',
      components: {
        header:  () => import('../components/Header.vue'),
        footer:  () => import('../components/Footer.vue'),
        default: () => import('../views/Detail.vue')
      }
    },
  ]
})

export default router
